package com.itheima.health.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.health.POJO.Setmeal;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.exception.CustomerException;
import com.itheima.health.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/setmeal")
public class SetmealController {
    @Autowired
    private SetmealService setmealService;
    /**
     * @description 体验套餐添加功能
     * @date 2021/11/28 8:38
     * @param setmeal:
     * @return com.itheima.health.entity.Result
     */
    @PostMapping("/add.do")
    public Result addSetmeal(@RequestBody Setmeal setmeal){
        setmealService.addSetmeal(setmeal);
        return new Result(true,"添加成功",null);
    }

    /**
     * @description 套餐分页查询
     * @date 2021/11/29 10:24
     * @param pageBean:
     * @return com.itheima.health.entity.PageResult
     */
    @PostMapping("/findPage.do")
    public PageResult findByPage(@RequestBody QueryPageBean pageBean){
        //1.非空判断
        if(pageBean==null){
            throw new CustomerException("参数异常");
        }
        return null;
    }
}
